package com.sprint.controller.utils;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

//spring mvc 异常处理器
@RestControllerAdvice
public class ProjectExceptionAdvice {

    @ExceptionHandler(Exception.class)
    public R doException(Exception ex){
        //记录日志：

        //通知运维

        //通知开发
        ex.printStackTrace();//经验代码，异常处理需要打印，不然无法抛出来
        return new R("服务器故障，稍后再试");
    }
}
